package com.yi.mall.demo.service.Impl;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yi.mall.demo.mapper.UserLoginLogMapper;
import com.yi.mall.demo.pojo.UserLoginLog;
import com.yi.mall.demo.service.IUserUserLoginLogService;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;
@Service
public class UserLoginLogServiceImpl extends ServiceImpl<UserLoginLogMapper, UserLoginLog> implements IUserUserLoginLogService {
    @Override
    public List<UserLoginLog> selectByUserId(Long userId){
        LambdaQueryChainWrapper<UserLoginLog> wrapper = new LambdaQueryChainWrapper<>(this.baseMapper);
        List<UserLoginLog> list = wrapper.eq(UserLoginLog::getUserId, userId)
                .orderByDesc(UserLoginLog::getCreateTime)
                .list();
        return list;
    }
}
